package cn.ekgc.angluarssm.service.impl;

import cn.ekgc.angluarssm.entity.Student;
import cn.ekgc.angluarssm.entity.StudentExample;
import cn.ekgc.angluarssm.mapper.StudentMapper;
import cn.ekgc.angluarssm.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author:jeson
 * @date: 2019/7/11 14:52
 * @参数注释：$params$
 * @返回值: $return$
 * @描述:$desciption$
 */
@Service
@Transactional
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper mapper;
    @Override
    public void save(Student student) {
        System.out.println(mapper);
        mapper.insert(student);
    }

    @Override
    public List<Student> list(StudentExample studentExample) {
        return mapper.selectByExample(studentExample);
    }

    @Override
    public Student list(int id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(Student student) {
        return mapper.updateByPrimaryKey(student);
    }

    @Override
    public int delete(int id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int delete(StudentExample studentExample) {
        return mapper.deleteByExample(studentExample);
    }


}
